<?php
/*
Template Name: Search Page
*/
?>

<?php
//global $query_string;
$s = filter_input(INPUT_GET, 'cs', FILTER_SANITIZE_STRING);
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$custom_query_args = array(
    's'=>$s,
	'showposts'=>-1,
	'post_type'=>'post',
	'sentence'=>1,
	'posts_per_page' => 10,
	//'paged'=>$paged
);
//s=$s&showposts=-1&post_type=post&sentence=1
//$custom_query_args['paged'] = get_query_var( 'paged' ) ?get_query_var( 'paged' )     : 1;
$allsearch = &new WP_Query($custom_query_args);

 $count = $allsearch->post_count;
   wp_reset_query();
   // $hits = $count == 1 ? $count." ".__("hit for","goodweb") : $count." ".__("hits for","goodweb");

?> 

<?php
get_header(); ?>
<div class="row clearfix">
    <div class="col-md-12 column content">
	<div class="row clearfix">
	<?php get_template_part( 'kolompertama2' ); ?>
	<div class="col-md-9 column" > <!-- untuk kolom kedua yang dibagi 2 -->
			<div class="row clearfix">
				<div class="col-md-12 column">
			<strong>	<a style="border-bottom:solid 1px red">Pencarian Cerita</a>&nbsp;&nbsp;&nbsp;<a href="<?php echo get_site_url()?>/searchauthor">Pencarian Penulis</a></strong><br/><br/>
               
				
		<?php if (!empty ($s)){
		?>
		 <div class="alert alert-info" role="alert">Hasil pencarian <?php echo '"'.$s.'"';?> :  <?php echo "Ditemukan <strong>".$count ."</strong> cerita" ;?></div>
		 <?php
		if ( $allsearch->have_posts() ) :while ( $allsearch->have_posts() ) : $allsearch->the_post(); 
		 get_template_part( 'content-page' ); 
    endwhile; ?>
				    
                </div>
				<?php //wp_pagenavi();
				wp_pagenavi(array('query'=>$allsearch));endif;}
				else  {?>
				 <div class="row">
                            <div class="col-md-2" style="margin-right:30px;margin-top:15px">
				<div class="fontjudul">Cari Cerita : </div></div>
				 <div class="col-md-8 textrecentpost">
				<?php get_search_form() ;};?></div></div>
            </div>
		</div><!-- end kolom kedua -->
		
       </div><!-- end row clearfix -->
</div> <!--end col-md-12 column content-->
</div>	<!-- end untuk content -->
     <!-- untuk iklan -->
	
    
    <!-- untuk footer -->
	<?php
get_footer();
?>
